-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More data access tests, some refactoring and cleanup #18312
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jdavcs
added
kind/enhancement
area/testing
area/database
Galaxy's database or data access layer
labels
Jun 4, 2024
4 tasks
jmchilton
approved these changes
Jun 10, 2024
We can't pass make_foo fixture functions as the default argument to kwd.get("foo", make_foo()) because make_foo is executed in any case, which creates a side effect by loading a new foo row into the database, which leads to failing tests since the number of foo records becomes off by one.
- factor out db access from lib manager; - add unit tests - move data access functions from managers.libraries to model.db.libraries
We do not verify the counts of rows in the HistoryAudit table because with the db trigger enabled, those rows are created automatically. Although it is possible to calculate the expected counts, those numbers would be dependend on previous db statements executed in the same test, and that calculation would be not straightforward, making the test brittle and confusing.
This tested SQLAlchemy: 1. create: dataset, job 2. set: dataset.job = job 3. save, then load dataset by dataset.id; verify that dataset.job = job
Tested SQLAlchemy: - create job - set job.tool_id - save, load job by id, verify job.tool_id
Tests SQLAlchemy: 1. Create tag 2. Verify there's no FooTagAssociation with this tag 3. Add new FooTagAssociation to Foo and save to db 4. Verify there is one FooTagAssociation with this tag
No assert (only TODO); but would test SQLAlchemy
Tests SQLAlchemy, user-history relationship mapping
Tests SQLAlchemy (create foo + set foo.bar + load foo + check bar)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/database
Galaxy's database or data access layer
area/testing
highlight/dev
Included in admin/dev release notes
kind/enhancement
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Replaces #17662. Builds on #18079.
More data-access unit testing. Database created and loaded once per session; cleared after each test. Dependent model instances created recursively as needed, with provided arguments or reasonable defaults. The key idea is (a) minimal setup, specifying only what's essential for a given test; and (b) auto-cleanup after each test to eliminate inter-test dependencies.
I've converted a bunch of tests from test_galaxy_mapping to use the new fixtures. The logic of the tests is unchanged, the only difference is the setup. Here's one example of what it looks like:
old
new
How to test the changes?
(Select all options that apply)
License